<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>AIR shell</title>
		<script src="servicemonitor.swf" type="application/x-shockwave-flash"></script>
		<script type="text/javascript" src="AIRIntrospector.js"></script>
		<script type="text/javascript" src="AIRAliases.js"></script>
		<script type="text/javascript">
			function URLTarget(url) {

				document.location = url;

			}

			function loadSetting() {

				var file = air.File.applicationDirectory.resolvePath("setting.xml"), fileStream = new air.FileStream(), appXml = new DOMParser();
				fileStream.addEventListener(air.Event.COMPLETE, function(evnet) {

					var xmlString = fileStream.readUTFBytes(fileStream.bytesAvailable), xmlObj = appXml.parseFromString(xmlString, "text/xml"), root = xmlObj.getElementsByTagName("app")[0], serverUrl = root.getElementsByTagName("server")[0].firstChild.data;

					URLTarget(serverUrl);					

				});
				fileStream.addEventListener(air.IOErrorEvent.IO_ERROR, function(event) {

					document.getElementById("tip").innerHTML = "配置文件丢失，请联系系统管理员";
					air.trace("Error message:");

				})
				fileStream.openAsync(file, air.FileMode.READ);

			}

			function maxWindow(){
					
				window.nativeWindow.maximize();	
				
			}

			/*var file = air.File.applicationDirectory.resolvePath("test.txt");
			 file.addEventListener(air.Event.COMPLETE, loaded);
			 file.load();
			 var str;
			 function loaded(event) {
			 var bytes = file.data;
			 str = bytes.readUTFBytes(bytes.length);
			 air.trace(str);
			 }*/
		</script>
	</head>
	<body onload="">
		<h1 id="tip">数据载入中...</h1>
		<button onclick="maxWindow();loadSetting()">最大化</button>
	</body>
</html>
